<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>quick-cocos2d-x API Documents - framework.client.luaj</title>
<link rel="stylesheet" href="luadocx-style.css" type="text/css" />
<link rel="stylesheet" href="luadocx-style-monokai.css" type="text/css" />
<script src="luadocx-highlight.min.js"></script>
<script type="text/javascript" charset="utf-8">hljs.initHighlightingOnLoad();</script>
</head>
<body>
  <div id="container">

    <table id="main">
      <tr>
        <td id="navigation">

          <h2>Links</h2>
          <ul>
            <li><a href="index.html">Index</a></li>
          </ul>

          <h2>Modules</h2>
          <ul>
            <li><a href="index.html">framework.init</a></li>
            <li><a href="framework.client.api.context.html">framework.client.api.Context</a></li>
            <li><a href="framework.client.api.eventprotocol.html">framework.client.api.EventProtocol</a></li>
            <li><a href="framework.client.api.gamenetwork.html">framework.client.api.GameNetwork</a></li>
            <li><a href="framework.client.api.gamestate.html">framework.client.api.GameState</a></li>
            <li><a href="framework.client.api.localize.html">framework.client.api.Localize</a></li>
            <li><a href="framework.client.api.store.html">framework.client.api.Store</a></li>
            <li><a href="framework.client.api.timer.html">framework.client.api.Timer</a></li>
            <li><a href="framework.client.api.gamenetwork.openfeint.html">framework.client.api.gamenetwork.OpenFeint</a></li>
            <li><a href="framework.client.audio.html">framework.client.audio</a></li>
            <li><a href="framework.client.crypto.html">framework.client.crypto</a></li>
            <li><a href="framework.client.device.html">framework.client.device</a></li>
            <li><a href="framework.client.display.html">framework.client.display</a></li>
            <li><a href="framework.client.init.html">framework.client.init</a></li>
            <li><strong>framework.client.luaj</strong></li>
            <li><a href="framework.client.luaoc.html">framework.client.luaoc</a></li>
            <li><a href="framework.client.network.html">framework.client.network</a></li>
            <li><a href="framework.client.scheduler.html">framework.client.scheduler</a></li>
            <li><a href="framework.client.transition.html">framework.client.transition</a></li>
            <li><a href="framework.client.ui.html">framework.client.ui</a></li>
            <li><a href="framework.server.mysqleasy.html">framework.server.MysqlEasy</a></li>
            <li><a href="framework.server.rediseasy.html">framework.server.RedisEasy</a></li>
            <li><a href="framework.server.serveraction.html">framework.server.ServerAction</a></li>
            <li><a href="framework.server.serverapp.html">framework.server.ServerApp</a></li>
            <li><a href="framework.server.session.html">framework.server.Session</a></li>
            <li><a href="framework.server.init.html">framework.server.init</a></li>
            <li><a href="framework.shared.modelbase.html">framework.shared.ModelBase</a></li>
            <li><a href="framework.shared.debug.html">framework.shared.debug</a></li>
            <li><a href="framework.shared.errors.html">framework.shared.errors</a></li>
            <li><a href="framework.shared.functions.html">framework.shared.functions</a></li>
          </ul>

        </td> <!-- navigation -->

        <td id="content">

          <h1>Module <code>framework.client.luaj</code></h1>

          <!-- BEGIN module doc -->

          <div id="module_doc">


          </div>

          <!-- END module doc -->


          <!--  BEGIN functions index -->

          <h2>Functions</h2>
          <table class="function_list">


            <tr>
              <td class="name" nowrap><a href="#anchor_checkArguments">checkArguments&nbsp;(args,&nbsp;sig)</a></td>
              <td class="summary">Call Java form Lua, and call Lua from Java.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_luaj_callStaticMethod">luaj.callStaticMethod&nbsp;(className,&nbsp;methodName,&nbsp;args,&nbsp;sig)</a></td>
              <td class="summary">Call Java Class Static Method</td>
            </tr>


          </table>

          <!--  END functions index -->

          <br />
          <br />

          <!-- BEGIN functions details -->

          <h2>Functions</h2>
          <dl class="function">


            <dt class="">
              <a name="anchor_checkArguments"></a>
              <h3>checkArguments (args, sig)</h3>
            </dt>

            <dd class="">

<p>Call Java form Lua, and call Lua from Java.</p>

<ul>
<li>Call Java Class Static Method from Lua</li>
<li>Pass Lua function to Java</li>
<li>Call Lua function from Java</li>
</ul>

<p><br /></p>

<p><strong>References:</strong></p>

<ul>
<li><a href="http://dualface.github.com/blog/2013/01/01/call-java-from-lua/">LuaJavaBridge - Call Java from Lua (Chinese only)</a></li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_luaj_callStaticMethod"></a>
              <h3>luaj.callStaticMethod (className, methodName, args, sig)</h3>
            </dt>

            <dd class="">

<p>Call Java Class Static Method</p>

<h3>Example:</h3>


<pre><code class="lua">local className = "com/flurry/android/FlurryAgent"
local args = {"APP_START"}
local sig  = "(Ljava/lang/String;)V"
local ok = luaj.callStaticMethod(className, "logEvent", args, sig)
if ok then
    -- call success
else
    -- call failure
end
</code></pre>

<h3>Parameters:</h3>

<ul>
<li>string <strong>className</strong> Java class name</li>
<li>string <strong>methodName</strong> Method name</li>
<li>[<em>optional table <strong>args</strong></em>] Arguments pass to Java</li>
<li>[<em>optional string <strong>sig</strong></em>] Java Method Signature</li>
</ul>

<blockquote>
  <p>Java Method Signature reference: <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI Types and Data Structures</a></p>
</blockquote>

<h3>Returns:</h3>

<ul>
<li>boolean call success or failure</li>
<li>mixed Java method returned value</li>
</ul>

            </dd>


          </dl>

          <!-- BEGIN functions details -->


      </td> <!-- id="content" -->

      </tr>
    </table> <!-- id="main" -->

    <div id="about">
      <i>update: 2013-05-08 09:30:25, generated by <a href="http://github.com/dualface/luadocx">luadocx 1.1</a></i>
    </div> <!-- id="about" -->

  </div> <!-- id="container" -->

</body>
</html>
